<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    p{
      width: 100px;
      height: 100px;
      background-color: aqua;
      position: absolute;
      top: 50px;
      left: 50px;
      border: 10px solid greenyellow;
      padding: 30px;
    }
    li{
      position: relative;
     border: 100px solid gold;
      margin-top: 50px;
      width: 500px;
      height: 500px;
      background-color: red;
    }
  </style>
</head>
<body>
  <ul>
    <li>
      <p>
        <span></span>
        <a href=""></a>
      </p>
    </li>
  </ul>
  <script src="../jquery-1.12.4.min.js"></script>
  <script>
//  读取距文档的位置
console.log($("p").offset());
console.log($("p").offset().left);
//  读取距上级定位的位置
console.log($("p").position());
console.log($("p").position().left);
  </script>
</body>
</html>